<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
	<base href="<%=basePath%>"><!-- jsp文件头和头部 -->
	<%@ include file="../../system/admin/top.jsp"%> 
	</head>
<body>
			<!-- 检索  -->
			<form action="boApplyEditInfo/editList.do" method="post" name="Form" id="Form">
			<div class="con-form">
			     <input autocomplete="off" id="nav-search-input" type="text" name="keyWord" value="${pd.keyWord}" placeholder="这里输入关键词" />
			     <button class="search" onclick="search();"  title="查询">查询</button>
			</div>
			<p class="operate">
                  <a class="delete" onclick="makeAll();" title="批量删除">批量删除</a>
             </p> 
			<table>
				  <colgroup>
		            <col width="2%">
		            <col width="2%">
		            <col width="13%">
		            <col width="9%">
		            <col width="13%">
		            <col width="9%">
		            <col width="6%">
		            <col width="13%">
		            <col width="13%">
		            <col width="6%">
		            <col width="13%">
		        </colgroup>
				<thead>
					<tr>
						<th><input type="checkbox" id="zcheckbox" /></th>
						<th>序号</th>
						<th>分公司名称</th>
						<th>成立时间</th>
						<th>地区</th>
						<th>业务范围</th>
						<th>保证金</th>
						<th>管理费</th>
						<th>合同到期时间</th>
						<th>审核状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				<!-- 开始循环 -->	
				<c:choose>
					<c:when test="${not empty  varList}">
						<c:if test="${QX.cha == 1 }">
						<c:forEach items="${varList}" var="var" varStatus="vs">
							<tr>
								        <td >
								        <input type="hidden" name="filiale_id" value="${var.filiale_id}" >
									    <input type='checkbox' name='ids' value="${var.filiale_id}" />
									    </td>
								        <td >${vs.index+1}</td>
										<td>${var.filiale_name}</td>
										<td ><fmt:formatDate value="${var.establish_time}" pattern="yyyy-MM-dd"/></td>
										<td>${var.region}</td>
										<td>${var.preparing_for_business}</td>
										<td>${var.filiale_operating_margin}</td>
										<td>${var.filiale_management_expense}</td>
										<td><fmt:formatDate value="${var.expire}" pattern="yyyy-MM-dd"/></td>
										<td>
										<c:if test="${ empty var.edit_status }">
										     <a  style="color: green;text-decoration: none">未提交申请</a>
										</c:if>
										<c:if test="${var.edit_status ==1}">
										     <a  style="color: green;text-decoration: none">正在审核</a>
										</c:if>
										<c:if test="${var.edit_status ==2}">
										    <a  style="color: green;text-decoration: none"> 审核通过</a>
										</c:if>
										<c:if test="${var.edit_status ==3}">
										    <a  style="color: green;text-decoration: none">  审核未通过</a>
										</c:if>
										</td>
								       <td style="width: 30px;" class="center">
								             <p class="operate">
												<a class="revise Operate" onclick="bChange('${var.filiale_id}')" title="信息变更" target="opFrame">信息变更</a>&nbsp;&nbsp;&nbsp;&nbsp;
												<a href="<%=basePath %>/boApplyEditInfo/goDetails.do?filiale_id=${var.filiale_id}" style="cursor: pointer;text-decoration: none " title="详情">详情</a>
										      </p>
										</td>
									
							</tr>
						</c:forEach>
						</c:if>
						<c:if test="${QX.cha == 0 }">
							<tr>
								<td colspan="100" class="center">您无权查看</td>
							</tr>
						</c:if>
					</c:when>
					<c:otherwise>
						<tr class="main_info">
							<td colspan="100" class="center" >没有相关数据</td>
						</tr>
					</c:otherwise>
				</c:choose>
				</tbody>
			</table>
		<div class="branchPage">${page.pageStr}</div>
		</form>
		<script type="text/javascript">
		//检索
		function search(){
			$("#Form").submit();
		}
		   //信息变更
		   function bChange(filiale_id){
			   $("#zhongxin",domObj).show();
			   $("#zhongxin iframe",domObj).attr("src","<%=basePath%>boApplyEditInfo/goEdit.do?filiale_id="+filiale_id);
		   }
		</script>
		
		<script type="text/javascript">
		
		$(function() {
			
			//下拉框
			$(".chzn-select").chosen(); 
			$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			
			//日期框
			$('.date-picker').datepicker();
			
			//复选框
			$('table th input:checkbox').on('click' , function(){
				var that = this;
				$(this).closest('table').find('tr > td:first-child input:checkbox')
				.each(function(){
					this.checked = that.checked;
					$(this).closest('tr').toggleClass('selected');
				});
					
			});
			
		});
		
		
		//批量操作
		function makeAll(){
		var str = '';
		for(var i=0;i < document.getElementsByName('ids').length;i++){
			  if(document.getElementsByName('ids')[i].checked){
			  	if(str==''){
			  		str += document.getElementsByName('ids')[i].value;
			  	}else{
			  		str += ',' + document.getElementsByName('ids')[i].value;
			  	}
			  }
		}
		if(str==''){
			$("#zcheckbox").tips({
				side:1,
	            msg:'点这里全选',
	            bg:'#AE81FF',
	            time:8
	        });
			return;
		}
		$.confirm('你确定要删除这条消息吗? ',null,function(type){
	        if(type==='yes'){
	        	$.ajax({
	    			type: "POST",
	    			url: '<%=basePath%>boapply/deleteAll.do?tm='+new Date().getTime(),
	    	    	data: {DATA_IDS:str},
	    			dataType:'json',
	    			cache: false,
	    			success: function(data){
	    				//刷新列表页面
	    				location.href='<%=basePath%>boapply/list.do';
	    			}
	    		});
	        }else{
	           //do Nothing
	        }
	        this.hide();
	    });
	}
		//导出excel
		function toExcel(){
			window.location.href='<%=basePath%>boapply/excel.do';
		}
		</script>
		
	</body>
</html>

